/**
 * PageProperty module
 */

import React, {Component} from 'react';
import PageH5ARContent from "./PageH5ARContent";
import PageShareContent from "./PageShareContent";
import PagePropertyContent from "./PagePropertyContent";
import FocusTab from "../../../consts/focusTabs";
class PageProperty extends Component {
    render(){
        const {page,focusTab,pageJump,fromTemplate} = this.props;
        var propertyNode = "";
        if (focusTab === FocusTab.PAGE){
            propertyNode = <PagePropertyContent fromTemplate={fromTemplate} page={page} pageJump={pageJump} />
        } else if(focusTab === FocusTab.H5AR) {
            propertyNode = <PageH5ARContent page={page} pageJump={pageJump} />
        } else if(focusTab === FocusTab.SHARE) {
            propertyNode = <PageShareContent pageJump={pageJump} />
        }
        
        if(!page) return false;
        if(fromTemplate){
            propertyNode = 
                <div className='fromTemplate-page'>
                    <PagePropertyContent fromTemplate={fromTemplate} page={page} pageJump={pageJump} />
                    <PageH5ARContent page={page} pageJump={pageJump} />
                    <PageShareContent pageJump={pageJump} />
                </div>
            
        }
        return (
            <div>
                { propertyNode }
            </div>
        )
    }
}

module.exports = PageProperty;
